# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=gx
pkgver=0.14.3
pkgrel=6
pkgdesc="Packaging tool build around the distributed, content addressed filesystem IPFS"
url="https://github.com/whyrusleeping/gx"
arch="all"
license="MIT"
options="!check chmod-clean" # Test suite issues
makedepends="git glide go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/whyrusleeping/gx/archive/v$pkgver.tar.gz
	glide.yaml
	glide.lock
	"
builddir="$srcdir/src/github.com/whyrusleeping/$pkgname"

prepare() {
	export GOPATH="$srcdir"

	mkdir -p $(dirname $builddir)
	mv "$srcdir"/$pkgname-$pkgver "$builddir"/

	cp "$srcdir"/glide.yaml "$srcdir"/glide.lock "$builddir"

	default_prepare
}

build() {
	glide install --skip-test
	GOPATH="$srcdir" GOBIN="$GOPATH/bin" make
}

package() {
	install -Dm 755 gx "$pkgdir/usr/bin/gx"
	install -Dm 644 -t "$pkgdir/usr/share/licenses/gx" LICENSE
}

glide_init() {
	abuild clean deps unpack prepare
	cd "$builddir"
	export GOPATH="$startdir"
	rm -f glide.yaml glide.lock
	glide init --non-interactive
	glide update
	cp glide.yaml glide.lock "$startdir"
	cd "$startdir" && abuild checksum clean
}

sha512sums="
14280680254aea69b1295e625788b39404a77defdcdd47399529ee818695965c06c6001de8adb0a44f641e66f9386ca9da3fc2c56a038c4b96a8ddd6252c3d49  gx-0.14.3.tar.gz
b1ac1cdd2ed760072cab4d63876ad711407bc467bee37ee3740b477f1071a13e0086afef99d15cb9267634ca8496aa92d1a1b399fc99f0479336433c9212810d  glide.yaml
6ddf9614c4244258191f0ba7fe1e41d5f84981795a71edc1f3d117f7ec72f1928d887a2dd9aecdb78c7cdac6c04eedf09e2e0af79f6049c337e122b5c7ac5ee7  glide.lock
"
